//tested, betting is not working. 
//letters are all well and good but we cannot see their score.
//round not really doing what it should. no proper betting, not able to deal with fold, losing player.



package game;


import java.util.List;
import java.io.IOException;
public class MainGame {
	int[] anArray = {0,1,2,3};
	ComputerAgent c0 ;
	ComputerAgent c1 ;
	ComputerAgent c2 ;
	PlayerAgent p;
	boolean bankrupcy = false;
	ComputerAgent[] fourToTheFloor = new ComputerAgent[4];
	public MainGame () {
		//try {
			c0 = new ComputerAgent(20, 50, 50, 1);
			c1 = new ComputerAgent(20, 50, 50, 2);
			c2 = new ComputerAgent(20, 50, 50, 3);
			p = new PlayerAgent(20);
//			c0.difficultyInt = c1.difficultyInt = c2.difficultyInt = c2.getDifficulty();
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
	}
	@SuppressWarnings("null")
	public void play(){
	
		while (!(p.isBankrupt()) || !(c0.isBankrupt()&& !c1.isBankrupt()&& !c2.isBankrupt())){

		try {
			ComputerAgent[] myList = {c0,c1,c2};
			Round aRound = new Round(p, myList);
			while (!bankrupcy){
			 fourToTheFloor = aRound.Hand();
			 fourToTheFloor = aRound.Hand();
			 c0 = fourToTheFloor[0];
			 c1 = fourToTheFloor[1];
			 c2 = fourToTheFloor[2];
			 p = new  PlayerAgent(fourToTheFloor[3]);
			 
			 c0.rack.emptyRack();
			 c1.rack.emptyRack();
			 c2.rack.emptyRack();
			 p.rack.emptyRack();
			 
			 bankrupcy = p.isBankrupt();
			 myList[0] = c0;
			 myList[1] = c1;
			 myList[2] = c2;
			}
						
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		}


		//}
	}
	public static void main(String [] args){
		MainGame myGame = new MainGame();
		myGame.play();
	}
}